<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改【客户信息】')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-client-edit" th:object="${client}">
            <input name="idClient" th:field="*{idClient}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">客户姓名：</label>
                <div class="col-sm-8">
                    <input name="nameClient" th:field="*{nameClient}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">所在城市：</label>
               <!-- <select class="btn btn-default dropdown-toggle" style="margin-left:12px " name="regionClient" th:with="type=${@dict.getRegion()}">
                    <option value="">所有</option>
                    <option th:each="dict : ${type}" th:text="${dict.nameRegion}" th:value="${dict.idRegion}"></option>
                </select>-->
                <select id="shi"  class="btn btn-default dropdown-toggle" style="margin-left:12px " onblur="zhenUpdate()">
                    <option value="" >所有</option>
                </select>
                <select id="zhen"  class="btn btn-default dropdown-toggle" style="margin-left:12px "  name="regionClient">
                    <option value="">所有</option>
                </select>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">详细地址：</label>
                <div class="col-sm-8">
                    <textarea name="addressStreetClient" class="form-control">[[*{addressStreetClient}]]</textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">手机：</label>
                <div class="col-sm-8">
                    <input name="phoneNum1Client" th:field="*{phoneNum1Client}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">紧急联系人：</label>
                <div class="col-sm-8">
                    <input name="phoneNum2Client" th:field="*{phoneNum2Client}" class="form-control" type="text">
                </div>
            </div>
            <!--<div class="form-group">
                <label class="col-sm-3 control-label">交易次数：</label>
                <div class="col-sm-8">
                    <input name="transTimeClient" th:field="*{transTimeClient}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">信用度：</label>
                <div class="col-sm-8">
                    <input name="creditClient" th:field="*{creditClient}" class="form-control" type="text" required>
                </div>
            </div>-->
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        $(function(){
            $("#shi").html("");
            let url = "/system/region/listById";
            let param = {"parentId":27425};
            $.getJSON(url,param,function(json){
                let rows = json.rows;
                $(rows).each(function(i,item){
                    let html = '';
                    html += '<option value='+item.idRegion+'>'+item.nameRegion+'</option>';
                    $("#shi").append(html);
                })
            })
        })
        function zhenUpdate(){
            $("#zhen").html("");
            let url = "/system/region/listById";
            let parentId = $("#shi").val();
            let param = {"parentId":parentId};
            $.getJSON(url,param,function(json){
                let rows = json.rows;
                console.log(rows);
                $(rows).each(function(i,item){
                    let html = '';
                    html += '<option value='+item.idRegion+'>'+item.nameRegion+'</option>';
                    $("#zhen").append(html);
                })
            })
        }
        var prefix = ctx + "system/client";
        $("#form-client-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-client-edit').serialize());
            }
        }
    </script>
</body>
</html>